package com.abe.libhttp.utils;

import android.content.Context;

public class BaseHttpUtils {
    private static Context context;
    private static boolean isShow = true;//是否输出日志

    private BaseHttpUtils() {
        throw new UnsupportedOperationException("u can't instantiate me...");
    }

    /**
     * 初始化工具类
     *
     * @param context 上下文
     */
    public static void init(Context context) {
        init(context, true);
    }

    public static void init(Context context, boolean isShowLog) {
        BaseHttpUtils.context = context.getApplicationContext();
        BaseHttpUtils.isShow = isShowLog;
    }

    /**
     * 获取ApplicationContext
     *
     * @return ApplicationContext
     */
    public static Context getContext() {
        if (context != null) return context;
        throw new NullPointerException("u should init first");
    }

    public static boolean isShow() {
        return isShow;
    }
}
